package cn.edu.scujcc;

import java.util.List;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RankingService {
	@Autowired
	private RankingRepositroy repo;
	
	public List<Ranking> getAllRanking(){
		List<Ranking>result = null;
		result = repo.findAll();
		return result;
	}
	public Ranking getRanking(String id) {
		Ranking result = null;
		Optional<Ranking> op = repo.findById(id);
		if (op.isPresent()) {
			result = op.get();
			}
		return result;
		}
	
	public Ranking createComment(String id) {
		Ranking result = null;
		Optional<Ranking> op = repo.findById(id);
		if (op.isPresent()) {
			result = op.get();
			}
		return result;
		}
}



